@extends('layouts._app')
@section('content')
    <body>
    <div class="layui-tab page-content-wrap">
        <div class="layui-form-item">
            <div class="layui-inline tool-btn">
                <a class="layui-btn layui-btn-small layui-btn-primary" id='email-refresh-btn'
                   href="{{route('system.modify.index')}}" data-title='刷新'>
                    <i class="layui-icon">&#x1002;</i>
                </a>
            </div>
        </div>
        <ul class="layui-tab-title">
            <li class="layui-this">修改资料</li>
            <li>修改密码</li>
            <li>修改头像</li>
        </ul>
        <div class="layui-tab-content">
            @include('layouts._flash')
            <div class="layui-tab-item layui-show">
                {!! Form::open(['route' => 'system.modify.store','class'=>'layui-form','style'=>'width: 90%;padding-top: 20px;','method'=>'put']) !!}
                {!! Form::hidden('status','1') !!}
                {!! Form::hidden('submit','1') !!}
                <div class="layui-form-item">
                    {!! Form::label('','ID：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('id',"{$user->id}",['class'=>'layui-input layui-disabled','disabled']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','用户名：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('',"{$user->name}",['class'=>'layui-input layui-disabled','disabled']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','姓名：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('rename',"{$user->info->rename}",['class'=>'layui-input','placeholder'=>'请输入姓名']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','邮箱：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-inline">
                        {!! Form::text('email',"{$user->email}",['class'=>'layui-input','id'=>'email_1','placeholder'=>'请输入邮箱号']) !!}
                    </div>
                    <a href="javascript:void(0);"
                       onclick="captcha('{{$user->id}}',1,'{{route('code')}}','{{ csrf_token() }}')" id="code_de_1"
                       style="margin:10px;text-align: center">发送验证码</a>
                    <span style="color: red">注：无更改无需发送</span>
                </div>
                <div class="layui-form-item" id="email_code_1" style="display: none;">
                    {!! Form::label('','邮箱验证码：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-inline">
                        {!! Form::text('code','',['class'=>'layui-input','readonly','id'=>'code_1','placeholder'=>'请填写验证码']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','编辑器：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        <input type="radio" name="editor" value="1" title="Markdown"
                               @if($user->info->editor == 1) checked @endif>
                        <input type="radio" name="editor" value="2" title="UEditor"
                               @if($user->info->editor == 2) checked @endif>
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    {!! Form::label('','备注：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::textarea('content',"{$user->info->content}",['class'=>'layui-textarea','placeholder'=>'请输入内容']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        {!! Form::submit('立即提交',['class'=>'layui-btn layui-btn-normal','lay-filter'=>'adminInfo','lay-submit']) !!}
                    </div>
                </div>
                {!! Form::close() !!}
            </div>
            <div class="layui-tab-item">
                {!! Form::open(['route' => 'system.modify.store','class'=>'layui-form','style'=>'width: 90%;padding-top: 20px;','method'=>'put']) !!}
                {!! Form::hidden('status','2') !!}
                <div class="layui-form-item">
                    {!! Form::label('','用户名：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('',"{$user->name}",['class'=>'layui-input layui-disabled','disabled']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 旧密码：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-block">
                        {!! Form::password('old_password',['class'=>'layui-input','lay-verify'=>'required','required','placeholder'=>'请输入密码']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 新密码：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-block">
                        {!! Form::password('password',['class'=>'layui-input','lay-verify'=>'required','required','placeholder'=>'请输入密码']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 重复密码：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-block">
                        {!! Form::password('password_confirmation',['class'=>'layui-input','lay-verify'=>'required','required','placeholder'=>'请输入密码']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        {!! Form::submit('立即提交',['class'=>'layui-btn layui-btn-normal','lay-filter'=>'adminPassword','lay-submit']) !!}
                    </div>
                </div>
                {!! Form::close() !!}
            </div>
            <div class="layui-tab-item">
                <br>
                {!! Form::open(['route' => 'upload','class'=>'layui-form','style'=>'width: 90%;padding-top: 20px;','method'=>'post','enctype'=>'multipart/form-data']) !!}
                <div class="layui-form-item">
                    {!! Form::label('','头像：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        <div class="user-headface" style="width: 80px;">
                            <img title="个人信息" alt="{{$user->name}}" id="img_show"
                                 style="margin:-10px;width: 60px;height: 60px;border-radius: 50%;"
                                 src="@if(isset($user->info->file)){{assetImage($user->info->file->url) ? : asset('static/admin/icon/35508.png')}}@else {{asset('static/admin/icon/35508.png')}}@endif">
                        </div>
                    </div>
                </div>
                <br>
                <div class="layui-form-item">
                    {!! Form::label('','上传：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        <div class="layui-box layui-upload-button">
                            {!! Form::hidden('category','avatar') !!}
                            {!! Form::hidden('user','admin') !!}
                            {!! Form::hidden('get','file') !!}
                            {!! Form::file('file',['id'=>'file0','onchange'=>'previewImage(this,0)']) !!}
                            <span class="layui-upload-icon"><i class="layui-icon"></i>上传图片</span>
                        </div>
                    </div>
                </div>
                <br>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        {!! Form::submit('立即提交',['class'=>'layui-btn layui-btn-normal','lay-filter'=>'adminUpload','lay-submit']) !!}
                    </div>
                </div>
                {!! Form::close() !!}
            </div>
        </div>
    </div>
    <script src="{{asset('static/admin/layui/layui.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="{{asset('js/jquery.min.js')}}" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="{{asset('js/jquery.base64.js')}}"></script>
    <script type="text/javascript" src="{{asset('js/jquery.cookie.js')}}"></script>
    <script type="text/javascript" src="{{asset('js/upload.js')}}"></script>
    <script type="text/javascript" src="{{asset('js/common.js')}}"></script>
    <script>
        var img = $('#img_show').attr('src');
        $('#filename', window.parent.document).attr('src', img);
        captchaInput(1);
        //Demo
        layui.use(['form', 'element'], function () {
            var form = layui.form();
            var element = layui.element();
            form.render();
            //监听信息提交
            form.on('submit(adminInfo)', function (data) {
            });
            //监听密码提交
            form.on('submit(adminPassword)', function (data) {
            });//监听密码提交
            form.on('submit(adminUpload)', function (data) {
            });
        });
    </script>
    </body>
@endsection
